home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_12_01
/
wingo
/
debugnew.cpp
< prev
Wrap
C/C++ Source or Header
|
1993-11-08
|
479b
|
29 lines
#include <stdlib.h>
// MFC style debug new defines.
class CObject
{
public:
#ifdef _DEBUG
// for file name/line number tracking using DEBUG_NEW
void* operator new(size_t nSize, char * lpszFileName, int nLine);
#endif
};
#ifdef _DEBUG
// Memory tracking allocation
#define DEBUG_NEW new(__FILE__, __LINE__)
#else
// NonDebug version that assume everything is OK
#define DEBUG_NEW new
#endif
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
main()
{
CObject *obj = new CObject;
}